import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { ChannelEntity } from "./channel.entity";
import { GuestEntity } from "./guest.entity";
import { OrderGuestEntity } from "./order_guest.entity";
import { OrderPaymentEntity } from "./order_payment.entity";
import { RoomEntity } from "./room.entity";
import { RoomTypeEntity } from "./roomType.entity";
import { UsersEntity } from "./user.entity";

@Entity({ name: 'order' })
export class OrderEntity extends BaseEntity {
    @PrimaryGeneratedColumn()
    id: number;

    @Column({
        type: 'varchar',
        length: 300
    })
    orderNo: string;//订单号

    @Column({
        type: 'tinyint',
        default: 1
    })
    status: 0 | 1; //0：禁用，1: 启用

    @Column({
        type: 'int',
        default: 0
    })
    amount: number;//合计

    @Column({
        type: 'int',
        default: 0
    })
    paidAmount: number;//支付金额

    @Column({
        type: 'int',
        default: 0
    })
    deposit: number;//押金

    @Column({
        type: 'int',
        default: 0
    })
    receivedDeposit: number;//已收押金

    @Column({
        type: 'int',
        default: 0
    })
    returnDeposit: number;//归还押金

    @Column({
        type: 'varchar',
        length: 300
    })
    remark: string;//备注信息

    @Column({
        type: 'datetime'
    })
    startTime: Date;//入住时间

    @Column({
        type: 'datetime'
    })
    endTime: Date;//结束入住时间

    @Column({
        type: 'int',
        default: 0
    })
    userId: number;//用户id

    users: UsersEntity;//用户

    channel: ChannelEntity;///外来订单

    roomType: RoomTypeEntity[] = new Array<RoomTypeEntity>;//预约房间

    guest: GuestEntity[] = new Array<GuestEntity>;//客人

    payLog: OrderPaymentEntity[] = new Array<OrderPaymentEntity>;//收银记录



}